package ar.org.cfired.hibernate.utils;

import java.io.Serializable;
import java.sql.Timestamp;

import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.type.Converter;

public class Variable implements Serializable {

	  private static final long serialVersionUID = 1L;

	  
	  protected long dbid = -1;
	  protected int dbversion = 0;
	  
	  protected String key = null;
	  protected Converter converter = null;
	  protected String textValue = null;
	  protected boolean isHistoryEnabled = false;
	  String classId;
	  String string_value;
	  String executionId;
	  String taskId;

	  Double doubleValue;
	  Long longValue;
	  Timestamp dateValue;
	  
	  public String getKey() {
		    return key;
		  }
		  public long getDbid() {
		    return dbid;
		  }
		  public void setDbid(long d) {
			  this.dbid=d;
		  }
		  public Converter getConverter() {
		    return converter;
		  }
		  public void setConverter(Converter converter) {
		    this.converter = converter;
		  }
		  public void setKey(String key) {
		    this.key = key;
		  }
		  public String getTextValue() {
		    return textValue;
		  }
		  public String getExecutionId() {
		    return executionId;
		  }
		  public void setExecutionId(String executionId) {
		    this.executionId = executionId;
		  }
		  public String getTask() {
		    return taskId;
		  }
		  public void setTask(String taskId) {
		    this.taskId = taskId;
		  }
		  public boolean isHistoryEnabled() {
		    return isHistoryEnabled;
		  }
		  public void setHistoryEnabled(boolean isHistoryEnabled) {
		    this.isHistoryEnabled = isHistoryEnabled;
		  }

		  
		  public String getStringValue() {
			   return string_value;
		  }
		  public void setStringValue(String v) {
			  this.string_value = v;
		  }
		  public Object getValue() {
			 Object rta = null;
			  if (this.classId.equals("string"))
				  rta = this.getStringValue();
			  if (this.classId.equals("long"))
			  	  rta = this.getLongValue();
			  if (this.classId.equals("double"))
				  rta = this.getDoubleValue();
			  if (this.classId.equals("date"))
				  rta = this.getDateValue();
			  return rta;
		  }
		  	
		  public String getClassId() {
			  return(this.classId);
		  }
		  public void setClassId(String cla) {
			  this.classId=cla;
		  }

		  public Double getDoubleValue() {
			  return (this.doubleValue);
		  }
		  public void setDoubleValue(Double d) {
			  this.doubleValue = d;
		  }

		  
		  public Long getLongValue() {
			  return (this.longValue);
		  }
		  public void setLongValue(Long d) {
			  this.longValue = d;
		  }


		  public Timestamp getDateValue() {
			  return (this.dateValue);
		  }
		  public void setDateValue(Timestamp d) {
			  this.dateValue = d;
		  }
		  
}
